home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-30 | 16.4 KB | 480 lines | [TEXT/MPS ] |
- //
- // rsrcCompress.r
- //
- // This installer script source demonstrates use of InstaCompOne
- // resource archives, split resources, the InstaCompOneTool
- // compression utility, and the FileAndRsrcSplitterTool.
- //
- // How To Build the Script:
- //
- // To build installer script access "Build…" item within "Build" menu
- // and enter the scriptName "rsrcCompress". To build the installer
- // debugger version of the installer script enter the scriptname
- // with the addition ".debug" ( "rsrcCompress.debug" ).
- //
- // There must be a copy of the file "InstaCompOneSCExt.rsrc"
- // that has been renamed to "rsrcCompress.scx" included in this
- // folder as well. This file will automatically be copied and
- // renamed ( from the InstaCompOne folder in the SDK ) when the
- // makefile for this example is run.
- //
- // What this example does :
- //
- // Four Custom Install options are provided to the user:
- //
- // 1) Installs a Example File onto the selected target
- // volume ( without use of compression or file splitting ). This
- // installed file is included only as the target of the other three
- // Custom Install options.
- //
- // NOTE: Resource installation can be specified as either requiring
- // an existing target file, or not requiring an existing target file.
- // All resource installation options in this example have been set
- // so that a target is required. If you try the resource installation
- // options ( 2), 3), 4) ) without first installing the first option,
- // an error dialog will be provided and installation will be prevented
- // from continuing.
- //
- // 2) Install resource item of type 'STR#' and ID 9000. Adds the
- // 'STR#' resource item to the Example File file installed in option 1).
- // This option demonstrates resource compression.
- //
- // 3) Install resource item of type 'STR#' and ID 9100. Adds the
- // 'STR#' resource item to the Example File file installed in option 1).
- // This option demonstrates resource splitting and compression.
- //
- // 4) Install resource item of type 'STR#' and ID 9200. Adds the
- // 'STR#' resource item to the Example File file installed in option 1).
- // This option demonstrates resource splitting.
- //
- //
- // All target files from example installations are placed in a
- // folder called ":InstaComp Rsrc Testing:" on the root folder of
- // the target volume of installation.
- //
- // NOTE: InstaCompOne can be used to split and compress files and
- // fonts in addition to resources, but this example deals only with
- // splitting and compressing resources. (For examples of file and font
- // compression and splitting see: "File Compression/Split Example",
- // "Font Compression/Split Example", and "InstaCompOneExample".)
- //
- // NOTE: It's best to store the split or compressed resource as type
- // 'part', instead of the original type, to prevent errors due to
- // the assumption that if it's of a certain type it must be complete.
- //
- // NOTE: When using InstaCompOne compression and splitting, simply enter 241
- // as the value for the atom extender ( 'inex' ) in the next to last field
- // of the atom ( 'infa', 'inff', 'inra' ) for the file/font/rsrc to be
- // decompressed. There is no need to declare an 'inex' resource within the
- // installer script source. An 'inex' resource definition is contained in
- // the InstaCompOne resource file that is included at the top of this file.
- //
- // NOTE: When splitting files or resources without using compression
- // pass a value of 0 ( zero ) for the atom extender in the atom extender
- // field of the atom ( 'infa', 'inra', 'inff' ).
- //
- // Copyright 1993-1996, Apple Computer, Inc., All Rights Reserved
- //
-
- #include "InstallerTypes.r"
-
- // Include the InstaCompOne atom extender stuff
- // making sure not to add their version resource
- // to our installer script. Also, since this include
- // is a resource include instead of a #include, it is
- // not actually a pre-processor thing, and won't be effected
- // by a -i option within the rez line in the makefile.
- include ":::Tools:Released:InstaCompOne 1.1:InstaCompAtomExt.rsrc" NOT 'vers';
-
-
- // • packages
-
- // package that installs Example File - no compression or splitting used
- // this file is intended only as the target for the following packages
- // that will install resource items into the Example File
- resource 'inpk' (100) {
- format0 {
- showsOnCustom,
- notRemovable,
- dontForceRestart,
- 0,
- 0,
- "Install Example File [ DO THIS FIRST !! SO RSRC'S CAN BE ADDED TO IT ]",
- {
- 'infa', 1000;
- },
- }
- };
-
- // package that demonstrates decompressing one resource item
- // and adding the result to one target file
- resource 'inpk' (200) {
- format0 {
- showsOnCustom,
- removable,
- dontForceRestart,
- 0,
- 0,
- "Add rsrc item 'STR#' (9000) to Example File [ compress rsrc example ]",
- {
- 'inra', 2000;
- },
- }
- };
-
- // package that demonstrates decompressing two resource item pieces
- // and adding the result to one target file
- resource 'inpk' (300) {
- format0 {
- showsOnCustom,
- removable,
- dontForceRestart,
- 0,
- 0,
- "Add rsrc item 'STR#' (9100) to Example File [ split,compress rsrc example ]",
- {
- 'inra', 3000;
- },
- }
- };
-
- // package that demonstrates joining two resource item pieces
- // and adding the result to one target file
- resource 'inpk' (400) {
- format0 {
- showsOnCustom,
- removable,
- dontForceRestart,
- 0,
- 0,
- "Add rsrc item 'STR#' (9200) to Example File [ split rsrc example ]",
- {
- 'inra', 4000;
- },
- }
- };
-
-
- // • file atoms
-
- // simple installation of Example File ( no compression, no splitting )
- resource 'infa' (1000) {
- format1 {
- deleteWhenRemoving, // Delete on deinstall
- deleteWhenInstalling, // Remove preexisting
- copy, // Copy on Install
- dontIgnoreLockedFile, // Respect file locking
- dontSetFileLocked, // Leave installed file unlocked
- useSrcCrDateToCompare, // Use creation date for compare
- srcNeedNotExist, // Create a new file if necessary
- rsrcForkInRsrcFork, // Resource stuff in Resource fork
- leaveAloneIfNewer, // Do not update a newer file
- updateExisting, // Update an existing file
- copyIfNewOrUpdate, // Copy whether target exists or not
- rsrcFork, // Copy resource fork
- dataFork, // Copy data fork
-
- 0, // TARGET - size ( filled in by ScriptCheck )
- 0x0, // finder attribute flags ( filled in by ScriptCheck )
- 10000, // TARGET - file spec ( 'infs' )
- {
- 11000, // SOURCE - file spec ( 'infs' )
- 0, // DATA fork - size ( filled in by ScriptCheck )
- 0 // RSRC fork - size ( filled in by ScriptCheck )
- },
-
- 0x0, // SOURCE - version number for comparisons
- // value of 0x0 specifies not to perform version comparison
-
- 0, // 'invc' code resource - version comparison routine
- // ( none used here )
-
- 0, // 'inex' resource definition for atom extender
- // • #241 is for built in InstaCompOne extender
- // NO COMPRESSION USED IN THIS EXAMPLE
-
- "Example File" // file atom description
- }
- };
-
-
- // • resource atoms
-
- // installation of a compressed resource item to target file
- resource 'inra' (2000) {
- format1 {
- deleteWhenRemoving, // Delete on deinstall
- deleteWhenInstalling, // Remove preexisting
- copy, // Copy on Install
- leaveAloneIfNewer, // Do not update a newer file
-
- tgtRequired, // Target file must already exist
- // • NOTE - this is the option
- // that prevents installation if
- // the target file to add the rsrc
- // item to does not already exist.
- // To create a new "empty" file
- // before adding the rsrc item
- // change the flag to 'noTgtRequired'
-
- updateExisting, // Update an existing file
- copyIfNewOrUpdate, // Copy whether target exists or not
- dontIgnoreProtection, // Respect file locking
- srcNeedExist, // Source file must exist
- byID, // Use rsrc ID instead of name
- nameNeedNotMatch, // Ignored when using 'byID'
-
- 0, // TARGET - total resource size after installation
- 10000, // TARGET - file spec ( 'intf' )
- 'STR#', // TARGET - resource type
- 9000, // TARGET - resource ID
- 0x0, // TARGET - resource attribute flags ( filled in by ScriptCheck )
- "", // TARGET - resource name
- {
- 12000, // SOURCE - file spec ( 'infs' )
- 'part', // SOURCE - resource type
- 9000, // SOURCE - resource ID
- 0, // TARGET - resource size ( filled in by ScriptCheck )
- "", // SOURCE - resource name
- },
-
- 0x0, // SOURCE - version number for comparisons
- // value of 0x0 specifies not to perform version comparison
-
- 0, // 'invc' code resource - version comparison routine
- // ( none used here )
-
- 241, // 'inex' resource definition for atom extender
- // • 241 is for built in InstaCompOne extender
-
- "", // resource atom description
- }
- };
-
-
- // installation of a split and compressed resource item to target file
- resource 'inra' (3000) {
- format1 {
- deleteWhenRemoving, // Delete on deinstall
- deleteWhenInstalling, // Remove preexisting
- copy, // Copy on Install
- leaveAloneIfNewer, // Do not update a newer file
-
- tgtRequired, // Target file must already exist
- // • NOTE - this is the option
- // that prevents installation if
- // the target file to add the rsrc
- // item to does not already exist.
- // To create a new "empty" file
- // before adding the rsrc item
- // change the flag to 'noTgtRequired'
-
- updateExisting, // Update an existing file
- copyIfNewOrUpdate, // Copy whether target exists or not
- dontIgnoreProtection, // Respect file locking
- srcNeedExist, // Source file must exist
- byID, // Use rsrc ID instead of name
- nameNeedNotMatch, // Ignored when using 'byID'
-
- 0, // TARGET - total resource size after installation
- 10000, // TARGET - file spec ( 'infs' )
- 'STR#', // TARGET - resource type
- 9100, // TARGET - resource ID
- 0x0, // TARGET - resource attribute flags ( filled in by ScriptCheck )
- "", // TARGET - resource name
- {
- 13000, // SOURCE - file spec ( 'infs' )
- 'part', // SOURCE - resource type
- 9100, // SOURCE - resource ID
- 0, // TARGET - resource size ( filled in by ScriptCheck )
- "", // SOURCE - resource name
-
- 13001, // SOURCE - file spec ( 'infs' )
- 'part', // SOURCE - resource type
- 9101, // SOURCE - resource ID
- 0, // TARGET - resource size ( filled in by ScriptCheck )
- "", // SOURCE - resource name
- },
-
- 0x0, // SOURCE - version number for comparisons
- // value of 0x0 specifies not to perform version comparison
-
- 0, // 'invc' code resource - version comparison routine
- // ( none used here )
-
- 241, // 'inex' resource definition for atom extender
- // • #241 is for built in InstaCompOne extender
-
- "", // resource atom description
- }
- };
-
-
- // installation of a split resource to target file
- // • InstaCompOne atom extender not need for non-compressed items
- resource 'inra' (4000) {
- format1 {
- deleteWhenRemoving, // Delete on deinstall
- deleteWhenInstalling, // Remove preexisting
- copy, // Copy on Install
- leaveAloneIfNewer, // Do not update a newer file
-
- tgtRequired, // Target file must already exist
- // • NOTE - this is the option
- // that prevents installation if
- // the target file to add the rsrc
- // item to does not already exist.
- // To create a new "empty" file
- // before adding the rsrc item
- // change the flag to 'noTgtRequired'
-
- updateExisting, // Update an existing file
- copyIfNewOrUpdate, // Copy whether target exists or not
- dontIgnoreProtection, // Respect file locking
- srcNeedExist, // Source file must exist
- byID, // Use rsrc ID instead of name
- nameNeedNotMatch, // Ignored when using 'byID'
-
- 0, // TARGET - total resource size after installation
- 10000, // TARGET - file spec ( 'infs' )
- 'STR#', // TARGET - resource type
- 9200, // TARGET - resource ID
- 0x0, // TARGET - resource attribute flags ( filled in by ScriptCheck )
- "", // TARGET - resource name
- {
- 14000, // SOURCE - file spec ( 'infs' )
- 'part', // SOURCE - resource type
- 9200, // SOURCE - resource ID
- 0, // TARGET - resource size ( filled in by ScriptCheck )
- "", // SOURCE - resource name
-
- 14001, // SOURCE - file spec ( 'infs' )
- 'part', // SOURCE - resource type
- 9201, // SOURCE - resource ID
- 0, // TARGET - resource size ( filled in by ScriptCheck )
- "", // SOURCE - resource name
- },
-
- 0x0, // SOURCE - version number for comparisons
- // value of 0x0 specifies not to perform version comparison
-
- 0, // 'invc' code resource - version comparison routine
- // ( none used here )
-
- 0, // Atom Extender not needed for joining ( w/o compression )
-
- "", // resource atom description
- }
- };
-
-
-
- // • file specs
-
- // target file spec for "Example File"
- // NOTE: When a target spec is called from within a resource atom of
- // any kind ( 'inra', 'inrm', 'inr#' ), the type, creator, dates and
- // Finder attributes fields will only apply when creating a new file.
- resource 'intf' (10000) {
- format1 {
- noSearchForFile, // use default search path
-
- TypeCrNeedNotMatch, // If this is set to TypeCrMustMatch
- // then a file with a different type
- // and creator than those specified
- // below will not be updated.
- // If this is set to TypeCrNeedNotMatch
- // then type and creator of an existing
- // target file are ignored.
-
- // The Type and Creator fields will be used to set the
- // file's Type and Creator when a new file is created.
- 'ttro', // TYPE for new file
- 'ttxt', // CREATOR for new file
-
- 0, // finder attribute flags
- // filled by ScriptCheck is value is 0
-
- 1, // creation date for new file
- 1, // modification date for new file
- // NOTE: DATE values are filled
- // by ScriptCheck if the value is 1
-
- 0, // search proc ID ( 'insp' ), none used
-
- ":InstaComp Rsrc Testing:Example File" // path to target file
- }
- };
-
- // source file spec for "Example File"
- // • no compression
- resource 'infs' (11000) {
- 'ttro', // TYPE for file search
- 'ttxt', // CREATOR for file search
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:Example File" // PATH to source file
- };
-
- // • compressed resource - file specs
-
- // source file spec for archive • compressed resource
- resource 'infs' (12000) {
- 'ircp', // TYPE
- 'kakc', // CREATOR
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:CompressedRsrcTome" // PATH to source file
- };
-
- // • split and compressed resource - file specs
-
- // source file spec for archive containing first piece
- // • split resource fork with compression
- resource 'infs' (13000) {
- 'ircp', // TYPE
- 'kakc', // CREATOR
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:SplitCompRsrcTome1" // PATH to source file
- };
-
- // source file spec for archive containing second piece
- // • split resource with compression
- resource 'infs' (13001) {
- 'ircp', // TYPE
- 'kakc', // CREATOR
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 2:SplitCompRsrcTome2" // PATH to source file
- };
-
- // • split resource - file specs
-
- // source file spec for archive containing first piece
- // • split resource
- resource 'infs' (14000) {
- 'rsrc', // TYPE
- 'RSED', // CREATOR
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:SplitRsrcTome1" // PATH to source file
- };
-
- // source file spec for archive containing second piece
- // • split resource
- resource 'infs' (14001) {
- 'rsrc', // TYPE
- 'RSED', // CREATOR
- 0x0, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 2:SplitRsrcTome2" // PATH to source file
- };
-
-